﻿#include "spectrumconversion.h"
#include "spectrum.h"

void Spectrum_Open(void **pSpectrum, int outFftLen, int winType, int type)
{
    *pSpectrum = new Spectrum(outFftLen, winType, type);
}

void Spectrum_ConversionMAXsf(void *pSpectrum, short inBuf[], int iLen, float outBuf[], float levelPoor, bool smooth, int smoothNum)
{
    Spectrum *spectrum = (Spectrum *)pSpectrum;
    spectrum->ConversionMAX(inBuf, iLen, outBuf, levelPoor, smooth, smoothNum);
}

void Spectrum_ConversionMEANsf(void *pSpectrum, short inBuf[], int iLen, float outBuf[], float levelPoor, bool smooth, int smoothNum)
{
    Spectrum *spectrum = (Spectrum *)pSpectrum;
    spectrum->ConversionMEAN(inBuf, iLen, outBuf, levelPoor, smooth, smoothNum);
}

void Spectrum_ConversionMINsf(void *pSpectrum, short inBuf[], int iLen, float outBuf[], float levelPoor, bool smooth, int smoothNum)
{
    Spectrum *spectrum = (Spectrum *)pSpectrum;
    spectrum->ConversionMIN(inBuf, iLen, outBuf, levelPoor, smooth, smoothNum);
}

void Spectrum_ConversionMAXss(void *pSpectrum, short inBuf[], int iLen, short outBuf[], short levelPoor, bool smooth, int smoothNum)
{
    Spectrum *spectrum = (Spectrum *)pSpectrum;
    spectrum->ConversionMAX(inBuf, iLen, outBuf, levelPoor, smooth, smoothNum);
}

void Spectrum_ConversionMEANss(void *pSpectrum, short inBuf[], int iLen, short outBuf[], short levelPoor, bool smooth, int smoothNum)
{
    Spectrum *spectrum = (Spectrum *)pSpectrum;
    spectrum->ConversionMEAN(inBuf, iLen, outBuf, levelPoor, smooth, smoothNum);
}

void Spectrum_ConversionMINss(void *pSpectrum, short inBuf[], int iLen, short outBuf[], short levelPoor, bool smooth, int smoothNum)
{
    Spectrum *spectrum = (Spectrum *)pSpectrum;
    spectrum->ConversionMIN(inBuf, iLen, outBuf, levelPoor, smooth, smoothNum);
}

void Spectrum_ConversionMAXfs(void *pSpectrum, float inBuf[], int iLen, short outBuf[], short levelPoor, bool smooth, int smoothNum)
{
    Spectrum *spectrum = (Spectrum *)pSpectrum;
    spectrum->ConversionMAX(inBuf, iLen, outBuf, levelPoor, smooth, smoothNum);
}
void Spectrum_ConversionMAXff(void *pSpectrum, float inBuf[], int iLen, float outBuf[], short levelPoor, bool smooth, int smoothNum)
{
    Spectrum *spectrum = (Spectrum *)pSpectrum;
    spectrum->ConversionMAX(inBuf, iLen, outBuf, levelPoor, smooth, smoothNum);
}
void Spectrum_Close(void *pSpectrum)
{
    delete pSpectrum;
}
